home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
-
- proc int connectionsSubMenu(string $editor, string $menu,
- string $attrCmd, string $cmd, string $title, string $type)
- //
- // Description:
- //
- // Build a submenu for the popup connection menu for a given
- // attribute type(single, double, triple, data, array
- //
- {
- string $getAttrsCmd = $attrCmd+" "+$type;
- string $attrs[] = `eval $getAttrsCmd`;
- int $numElements = 2;
- int $length = size($attrs);
- if($length != 0) {
- if($type != "all") {
- menuItem -l $title -sm 1;
- }else{
- if($length > 8) {
- return $length;
- }
- }
-
- int $i;
- if($type != "multi") {
- for ($i = 0 ; $i < $length ; $i += $numElements) {
- int $italicize = ($attrs[$i+1] == "Connected");
- menuItem -l $attrs[$i]
- -italicized $italicize -boldFont $italicize
- -c ($cmd+"."+$attrs[$i]+" "+$editor);
- }
- }else{
- for ($i = 0 ; $i < $length ; $i += $numElements) {
- menuItem -l $attrs[$i] -sm 1;
- int $italicize = ($attrs[$i+1] == "Connected");
- int $j;
- for ($j = 0 ; $j < 3 ; $j++) {
- string $label = ($attrs[$i] + "[" + $j + "]");
- menuItem -l $label
- -italicized $italicize -boldFont $italicize
- -c ($cmd+"."+$attrs[$i]+" "+$editor);
- }
- setParent ..;
- }
- }
- setParent -m $menu;
- }
- return $length;
- }
-
- global proc hypergraphConnectionBeginMenu(string $editor, string $menu,
- string $node, string $inputs)
- //
- // Description:
- // Called to initiate a connection when using the popup connection
- // editing capability in the Hypergraph and Hypershade. This will
- // build a popup menu showing all the available attributes for
- // either inputs or outputs.
- //
- {
- string $attrCmd;
- string $cmd;
- int $subMenu = 1;
-
- setParent -m $menu;
- popupMenu -e -deleteAllItems $menu;
-
- menuItem -l $inputs;
- menuItem -divider true;
-
- if($inputs == "Inputs") {
- $attrCmd = "attributeMenu -inputs "+$node+" -attrType ";
- $cmd = "hyperGraph -e -newInputConnection "+$node;
- }else{
- $attrCmd = "attributeMenu -outputs "+$node+" -attrType ";
- $cmd = "hyperGraph -e -newOutputConnection "+$node;
- int $len;
- $len = connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "All", "all");
- if($len <= 8) {
- $subMenu = 0;
- }
- }
-
- if($subMenu == 1) {
- connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "Single", "single");
- connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "Double", "double");
- connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "Triple", "triple");
- connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "Data", "data");
- connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "Array", "multi");
- }
- }
-